<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0" />
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <title>登录</title>
    <link type="image/x-icon" rel="shortcut icon" href="../images/favicon.ico">
    <link rel="stylesheet" href="../res/mui/css/mui.min.css" />
    <link rel="stylesheet" href="../res/fontAwesome/css/font-awesome.min.css" />
    <link rel="stylesheet" href="../css/common.css" />
    <link rel="stylesheet" href="../css/user.css" />
</head>

<body>
    <div class="cz_layout">
        <header class="cz_topBar">
            <a href="javascript:history.back();" class="icon_back fa fa-arrow-left"></a>
            <span class="title">登录</span>
        </header>
        <form id="log_form">
            <div class="cz_container">
                <div class="form_box">
                    <div class="mui-input-row">
                        <input name="username" type="text" placeholder="用户名/手机号">
                    </div>
                    <div class="mui-input-row">
                        <input name="password" type="password" placeholder="密码" class="mui-input-password">
                        <span class="mui-icon mui-icon-eye"></span>
                    </div>
                    <button class="mui-btn mui-btn-primary btn_login">登录</button>
                    <div class="mui-input-row cz_text">
                        <a href="register.html">免费注册</a>
                    </div>
                </div>
            </div>
        </form>
        <footer class="cz_tabs">
            <a class="tab_home fa fa-home" href="../index.html"><span>首页</span></a>
            <a class="tab_cate fa fa-bars" href="../cate.html"><span>分类</span></a>
            <a class="tab_cart fa fa-shopping-cart" href="../cart.html"><span>购物车</span></a>
            <a class="tab_user fa fa-user" href="../user/index.html"><span>会员中心</span></a>
        </footer>
    </div>
    <script src="../jquery.min.js"></script>
    <script src="../res/mui/js/mui.min.js"></script>

    <script>

        //登录
        $('#log_form').on("submit", function () {
            var data = $(this).serialize();
            console.log(data)
            $.ajax(
                {
                    //  url: "http://localhost:3000/user/login",
                    url: "/api/user/login",
                    type: 'post',
                    data: data,
                    success: function (info) {
                        if(info.success)
                         location.href='./index.html'
                    }
                })

            return false;
        })
    </script>

</body>

</html>